# -*- coding: utf-8 -*-
# @Author	: brotherbaby
# @Date		: 2023/10/25 10:11
# @Last Modified by:   brotherbaby
# @Last Modified time: 2023/10/25 10:11
# Thanks for your comments!

from sqlalchemy import Column, Integer, VARCHAR, BigInteger

from src.consts import ModelName
from src.db_proxy.models.modelbase import ModelBase, ModifyingBehevior


class Person(ModelBase, ModifyingBehevior):
    __tablename__ = ModelName.Person.value

    id = Column('id', Integer, primary_key=True, autoincrement=True)
    name = Column('name', VARCHAR(64), index=True)
    phone = Column('phone', VARCHAR(64), index=True, nullable=False)
    gender = Column('gender', Integer)  # 性别 0未知, 1男 2女
    birthdate = Column('birthdate', BigInteger)  # 出生年月日，秒数

    def get_fields(self):
        return {
            "id": self.id,
            "name": self.name,
            "phone": self.phone,
            "gender": self.gender,
            "birthdate": self.birthdate
        }
